package dianmobile.eistarandroid.network.request;

import android.content.Context;

import com.android.volley.Response;

import org.xmlpull.v1.XmlPullParser;

import java.util.Map;

import dianmobile.eistarandroid.utils.ConstantsData;

/**
 * Created by dianmobile_yy on 15/10/8.
 */
public class BookBoardRequest extends ByhhAndroidRequest {

    public BookBoardRequest(int method, String url, Map<String, String> params, RequestCallback callback, Response.ErrorListener listener) {
        super(method, url, params, callback, listener);
    }

    public static void execute(Context context, RequestType type, Map<String, String> params, RequestCallback callback) {
        executeSuper(context, type, params, callback);
    }

    protected void parseXmlToMap(XmlPullParser parser, Map<String, Object> result){
        String TAG_ERROR = "error";
        try {
            int event = parser.getEventType();
            while (event != XmlPullParser.END_DOCUMENT){
                switch (event) {
                    case XmlPullParser.START_TAG:
                        String tag = parser.getName();
                        if(TAG_ERROR.equals(tag)) {
                            result.put(ConstantsData.ERROR_RESULT, parser.nextText());
                        }
                        break;
                    default:
                        break;
                }
                event = parser.next();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
